home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 417_01 / libftp / examples / get.c < prev   
Encoding:
C/C++ Source or Header  |  1994-03-24  |  882 b   |  42 lines

  1. /*
  2.               Library for ftpd clients.(libftp)
  3.             Copyright by Oleg Orel
  4.              All rights reserved.
  5.             
  6. This  library is desined  for  free,  non-commercial  software  creation. 
  7. It is changeable and can be improved. The author would greatly appreciate 
  8. any  advises, new  components  and  patches  of  the  existing  programs.
  9. Commercial  usage is  also  possible  with  participation of it's author.
  10.  
  11.  
  12.  
  13. */
  14.  
  15. #include "FtpLibrary.h"
  16.  
  17. main(int a,char **b)
  18. {
  19.   FILE *out,*in;
  20.   String localfile;
  21.   int c;
  22.   
  23.  
  24.   if ( a != 2 )
  25.     {
  26.       fprintf(stderr,
  27.           "Usage: %s node/user/pass:input-file\n",
  28.           b[0]);
  29.       exit(1);
  30.     }
  31.   if ((in=FtpFullOpen(b[1],"r"))==NULL)
  32.     perror(b[1]),exit(1);
  33.   sscanf(b[1],"%*[^:]:%s",localfile);
  34.   if ((out=fopen(localfile,"w"))==NULL)
  35.     perror(b[2]),exit(1);
  36.  
  37.   while((c=getc(in))!=EOF)
  38.     putc(c,out);
  39.   FtpFullClose(in);
  40.   fclose(out);
  41. }
  42.